# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>

pkgname=toml-bombadil
pkgver=3.1.0
pkgrel=2
pkgdesc="Adotfile manager with templating"
arch=('loong64' 'x86_64')
url="https://github.com/oknozor/toml-bombadil"
license=('MIT')
depends=('gcc-libs' 'zlib')
makedepends=('rust')
options=(!lto)
source=($pkgname-$pkgver.tar.gz::https://github.com/oknozor/toml-bombadil/archive/${pkgver}.tar.gz)
sha512sums=('ea9e25a0e6540317c32d992351414730a097dcc257ba053a4b003635f807687635d606071ebddb2cdcf2344f9fd66e71109d549b520eb669ef1e94a0188f6ff2')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  cargo build --release --locked
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  install -Dm755 target/release/bombadil "$pkgdir"/usr/bin/bombadil

  mkdir -p "$pkgdir"/usr/share/{bash-completion/completions,zsh/site-functions,fish/vendor_completions.d}
  target/release/bombadil generate-completions bash > "$pkgdir"/usr/share/bash-completion/completions/bombadil
  target/release/bombadil generate-completions zsh > "$pkgdir"/usr/share/zsh/site-functions/_bombadil
  target/release/bombadil generate-completions fish > "$pkgdir"/usr/share/fish/vendor_completions.d/bombadil.fish

  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
